<!DOCTYPE html>
<html lang="en">

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>translate位移</title>
  </head>
  <style>
    /* 
    一.位移：translate
      1.1 translate(x,y):单位可以是px
      1.2单位也可以是百分比，参照物是元素本身
      1.3 参数可以是(x,y),x,y轴都位移
      1.4 参数(x),设置x轴上得位移
     */
    .box1 {
      width: 100px;
      height: 100px;
      background-color: pink;
      transition: all 1s;
    }

    .box2 {
      width: 100px;
      height: 100px;
      background-color: red;
      transition: all 1s;
    }

    .box1:hover {
      transform: translate(100px, 0)
    }

    .box2:hover {
      transform: translate(100%, 0)
    }
  </style>

  <body>
    <div class="box1">div1</div>
    <div class="box2">div2</div>
  </body>

</html>